﻿{template 'header', $module}
<link rel="stylesheet" type="text/css" href="{DT_STATIC}{$MODULE[2][moduledir]}/image/message.css"/>
<div class="menu">
<table cellpadding="0" cellspacing="0">
<tr>
<td class="tab" id="add"><a href="?action=send"><span>Send letters</span></a></td>
<td class="tab_nav">&nbsp;</td>
<td class="tab" id="inbox"><a href="?action=inbox"><span>Inbox</span></a></td>
<td class="tab_nav">&nbsp;</td>
<td class="tab" id="outbox"><a href="?action=outbox"><span>Sent</span></a></td>
<td class="tab_nav">&nbsp;</td>
<td class="tab" id="draft"><a href="?action=draft"><span>Drafts</span></a></td>
<td class="tab_nav">&nbsp;</td>
<td class="tab" id="recycle"><a href="?action=recycle"><span>Recycle</span></a></td>
<td class="tab_nav">&nbsp;</td>
<td class="tab" id="export"><a href="?action=export"><span>Export Letters</span></a></td>
<td class="tab_nav">&nbsp;</td>
<td class="tab" id="empty"><a href="?action=empty"><span>Letters cleanup</span></a></td>
<td class="tab_nav">&nbsp;</td>
<td class="tab" id="setting"><a href="?action=setting"><span>Letters Set</span></a></td>
</tr>
</table>
</div>
{if $action == 'send'}
<form method="post" action="message.php" id="dform" onsubmit="return check();">
<input type="hidden" name="action" value="{$action}"/> 
<input type="hidden" name="typeid" value="{$typeid}"/> 
<table cellspacing="1" cellpadding="6" class="tb">
<tr>
<td class="tl"><span class="f_red">*</span> Addressee</td>
<td class="tr f_gray"><input type="text" size="45" name="message[touser]" id="touser" value="{$touser}"/>&nbsp;&nbsp;<a href="javascript:Dwidget('friend.php?action=my', '[My Friends]', 600, 300);" class="t">[My Friends]</a> <span id="dtouser" class="f_red"></span>
<br/>Press the spacebar multiple recipients simultaneously separating up to send{$MOD[maxtouser]}Recipients</td>
</tr>
<tr>
<td class="tl"><span class="f_red">*</span> Title</td>
<td class="tr"><input type="text" size="60" name="message[title]" id="title" value="{$title}"/> <span id="dtitle" class="f_red"></span></td>
</tr>
<tr>
<td class="tl"><span class="f_red">*</span> Content</td>
<td class="tr"><textarea name="message[content]" id="content" class="dsn">{$content}</textarea>
{deditor($moduleid, 'content', 'Simple', '98%', 200)}<span id="dcontent" class="f_red"></span>
</td>
</tr>
<tr>
<td class="tl">Options</td>
<td class="tr">
<input type="checkbox" name="message[save]" id="save" value="1" onclick="if(this.checked){Dd('copy').checked=Dd('feedback').checked=false;}"/> Do not send, save it as a draft
<input type="checkbox" name="message[copy]" id="copy" value="1" onclick="if(this.checked){Dd('save').checked=false;}"/> Saved to the Sent
<input type="checkbox" name="message[feedback]" id="feedback" value="1" onclick="if(this.checked){Dd('save').checked=false;}"/> Read Receipts
</td>
</tr>
{if $need_captcha}
<tr>
<td class="tl"><span class="f_red">*</span> Verification code</td>
<td class="tr">{template 'captcha', 'chip'} <span id="dcaptcha" class="f_red"></span></td>
</tr>
{/if}
<tr>
<td class="tl"> </td>
<td class="tr" height="50">
<input type="submit" name="submit" value=" Determined " class="btn"/>&nbsp;&nbsp;&nbsp;&nbsp;<input type="reset" name="reset" value=" Reset " class="btn"/>
{if $MG[message_limit]}
&nbsp;&nbsp;&nbsp;Today can be made <span class="f_b f_red">{$MG[message_limit]}</span> Secondary
&nbsp;&nbsp;&nbsp;Current issue <span class="f_b">{$limit_used}</span> Secondary
&nbsp;&nbsp;&nbsp;You can also send <span class="f_b f_blue">{$limit_free}</span> Secondary
{/if}
</td>
</tr>
</table>
</form>
{load('clear.js')}
<script type="text/javascript">
function check() {
	var len;
	if(Dd('save').checked == false) {
		if(Dd('touser').value == '') {
			Dmsg('Please fill in the recipient', 'touser');
			return false;
		}
		var max = {$MOD[maxtouser]};
		if(max && substr_count(Dd('touser').value, ' ') >= max) {
			Dmsg('You can select up'+max+'Recipients', 'touser');
			return false;
		}
	}
	len = Dd('title').value.length;
	if(len < 5) {
		Dmsg('Content is not more than 5 words, the current has been entered '+len+' characters', 'title');
		return false;
	}
	if(len > 60) {
		Dmsg('Content is not more than 60 words, the current has been entered '+len+' characters', 'title');
		return false;
	}
	len = FCKLen();
	if(len < 10) {
		Dmsg('Content is not more than 10 words, the current has been entered '+len+' characters', 'content');
		return false;
	}
	if(len > 5000) {
		Dmsg('Content is not more than 5000 words, the current has been entered '+len+' characters', 'content');
		return false;
	}
{if $need_captcha}
	f = 'captcha';
	l = Dd(f).value;
	if(!is_captcha(l)) {
		Dmsg('Please fill in the correct verification code', f);
		return false;
	}
	if(Dd('c'+f).innerHTML.indexOf('error') != -1) {
		Dd(f).focus();
		return false;
	}
{/if}
	return true;
}
</script>
{php $action='add'}
{elseif $action == 'edit'}
<form method="post" action="message.php" id="dform" onsubmit="return check();">
<input type="hidden" name="action" value="{$action}"/> 
<input type="hidden" name="itemid" value="{$itemid}"/> 
<table cellspacing="1" cellpadding="6" class="tb">
<tr>
<td class="tl"><span class="f_red">*</span> Addressee</td>
<td class="tr f_gray"><input type="text" size="45" name="message[touser]" id="touser" value="{$touser}"/>&nbsp;&nbsp;<a href="javascript:Dwidget('friend.php?action=my', '[My Friends]', 600, 300);" class="t">[My Friends]</a> <span id="dtouser" class="f_red"></span><br/>Press the spacebar multiple recipients simultaneously separating up to send{$MOD[maxtouser]}Recipients</td>
</tr>
<tr>
<td class="tl"><span class="f_red">*</span> Title</td>
<td class="tr f_gray"><input type="text" size="60" name="message[title]" id="title" value="{$title}"/> <span id="dtitle" class="f_red"></span></td>
</tr>
<tr>
<td class="tl"><span class="f_red">*</span> Content</td>
<td class="tr f_gray"><textarea name="message[content]" id="content" class="dsn">{$content}</textarea>
{deditor($moduleid, 'content', 'Simple', '98%', 200)}<span id="dcontent" class="f_red"></span>
</td>
</tr>
<tr>
<td class="tl">选项</td>
<td class="tr">
<input type="checkbox" name="message[send]" id="sendmsg" value="1" onclick="if(!this.checked){Dd('copy').checked=Dd('feedback').checked=false;}"/> Send letters
<input type="checkbox" name="message[copy]" id="copy" value="1" onclick="if(this.checked){Dd('sendmsg').checked=true;}"/> Saved to the Sent
<input type="checkbox" name="message[feedback]" id="feedback" value="1" onclick="if(this.checked){Dd('sendmsg').checked=true;}"/> Read Receipts
</td>
</tr>
<tr>
<td class="tl">&nbsp;</td>
<td class="tr" height="50"><input type="submit" name="submit" value=" Modified " class="btn"/>&nbsp;&nbsp;&nbsp;&nbsp;<input type="button" value=" Back " class="btn" onclick="history.back(-1);"/></td>
</tr>
</table>
</form>
{load('clear.js')}
<script type="text/javascript">
function check() {
	var len;
	if(Dd('sendmsg').checked == true) {
		if(Dd('touser').value == '') {
			Dmsg('Please fill in the recipient', 'touser');
			return false;
		}
		var max = {$MOD[maxtouser]};
		if(max && substr_count(Dd('touser').value, ' ') >= max) {
			Dmsg('You can select up'+max+'Recipients', 'touser');
			return false;
		}
	}
	len = Dd('title').value.length;
	if(len < 5) {
		Dmsg('Title can not be less than five characters, the current has been entered '+len+' characters', 'title');
		return false;
	}
	if(len > 60) {
		Dmsg('Title can not be more than 60 characters, the current has been entered '+len+' characters', 'title');
		return false;
	}
	len = FCKLen();
	if(len < 10) {
		Dmsg('Content of not less than 10 words, the current has been entered '+len+' characters', 'content');
		return false;
	}
	if(len > 5000) {
		Dmsg('Content is not more than 5000 words, the current has been entered '+len+' characters', 'content');
		return false;
	}
	return true;
}
</script>
{php $action='draft'}
{elseif $action == 'export'}
<form method="post" action="message.php">
<input type="hidden" name="action" value="{$action}"/>
<table cellspacing="1" cellpadding="6" class="tb">
<tr>
<td class="tl">Prompt</td>
<td class="tr f_blue">&nbsp;Export important letters regularly to avoid being automatically cleared</td>
</tr>
<tr>
<td class="tl">Letter</td>
<td class="tr">
<input type="radio" value="3" name="message[status]" checked="checked"/> Inbox
<input type="radio" value="2" name="message[status]" /> Sent
<input type="radio" value="1" name="message[status]" /> Drafts
<input type="radio" value="4" name="message[status]" /> Recycle
</td>
</tr>
<tr>
<td class="tl">Date Range</td>
<td class="tr">
{dcalendar('message[fromdate]', $fromdate)} To {dcalendar('message[todate]', $todate)}
<br/><span class="f_gray">A maximum export 100, set a reasonable period of time to avoid missing some letters</span>
</td>
</tr>
<tr>
<td class="tl">Options</td>
<td class="tr">
<input type="checkbox" value="1" name="message[isread]" /> Export only unread messages
</td>
</tr>
<tr>
<td class="tl"> </td>
<td class="tr" height="50">
<input type="submit" name="submit" value=" Lead out " class="btn"/>&nbsp;&nbsp;&nbsp;&nbsp;<input type="reset" name="reset" value=" Reset " class="btn"/>
</td>
</tr>
</table>
</form>
{elseif $action == 'empty'}
<form method="post" action="message.php">
<input type="hidden" name="action" value="{$action}"/>
<table cellspacing="1" cellpadding="6" class="tb">
<tr>
<td class="tl">Letter</td>
<td class="tr">
<input type="radio" value="3" name="message[status]" checked="checked"/> Inbox
<input type="radio" value="2" name="message[status]" /> Sent
<input type="radio" value="1" name="message[status]" /> Drafts
<input type="radio" value="4" name="message[status]" /> Recycle
</td>
</tr>
<tr>
<td class="tl">Date Range</td>
<td class="tr">
{dcalendar('message[fromdate]', $fromdate)} To {dcalendar('message[todate]', $todate)}
</td>
</tr>
<tr>
<td class="tl">Options</td>
<td class="tr">
<input type="checkbox" value="1" name="message[isread]" checked/> Leaving unread messages
</td>
</tr>
<tr>
<td class="tl"> </td>
<td class="tr" height="50">
<input type="submit" name="submit" value=" Clearance " class="btn" onclick="if(!confirm('Sure to clean it? This action shall be irrevocable')) return false;"/>&nbsp;&nbsp;&nbsp;&nbsp;<input type="reset" name="reset" value=" Reset " class="btn"/>
</td>
</tr>
</table>
</form>
{elseif $action == 'show'}
<div class="message_head">
	<strong class="px14">{$title}</strong><br/>
	{if $status==4 || $status==3}
		{if $fromuser}
		<span>Sender：</span><a href="{userurl($fromuser)}" target="_blank" class="t">{$fromuser}</a><br/>
		{/if}
	{elseif $status==2}
	<span>Addressee：</span><a href="{userurl($touser)}" target="_blank" class="t">{$touser}</a><br/>
	{/if}
	<span>Edit&nbsp;&nbsp;&nbsp;Number：</span>{$itemid}<br/>
	<span>Time&nbsp;&nbsp;&nbsp;Between：</span>{$addtime}<br/>
</div>
<div class="message_body">
{$content}
</div>
<div class="message_foot">
<input type="button" value=" Back " class="btn" onclick="history.back(-1);"/>
{if $status==4}
<input type="button" class="btn" value="Restore" onclick="Go('?action=restore&itemid={$itemid}&forward={urlencode('?action=inbox')}');"/> 
{if $fromuser}
<input type="button" class="btn" value="Reply" onclick="Go('?action=send&touser={$fromuser}&title=RE:{urlencode($title)}');"/> 
<input type="button" class="btn" value="Forwarding" onclick="Dd('_send').submit();"/>
<input type="button" class="btn" value="Refused to close" onclick="if(confirm('Sure you want to reject messages from {$fromuser} The station believe it？'))Go('?action=refuse&username={$fromuser}');"/>  
{/if}
<input type="button" class="btn" value="Completely remove" onclick="if(confirm('You sure you want to delete this email? This action can not be revoked')) Go('?action=delete&itemid={$itemid}&forward={urlencode('?action=recycle')}');"/> 
{php $action='recycle'}
{elseif $status==3}
{if $fromuser}
<input type="button" class="btn" value="Reply" onclick="Go('?action=send&touser={$fromuser}&title=RE:{urlencode($title)}');"/> 
<input type="button" class="btn" value="Forwarding" onclick="Dd('_send').submit();"/>
<input type="button" class="btn" value="Refused to close" onclick="if(confirm('Sure you want to reject messages from {$fromuser} The station believe it？'))Go('?action=refuse&username={$fromuser}');"/>  
{/if}
<input type="button" class="btn" value="Recycle" onclick="Go('?action=delete&itemid={$itemid}&forward={urlencode('?action=inbox')}');"/>
<input type="button" class="btn" value="Completely remove" onclick="if(confirm('You sure you want to delete this email? This action can not be revoked')) Go('?action=delete&recycle=0&itemid={$itemid}&forward={urlencode('?action=inbox')}');"/> 
{php $action='inbox'}
{elseif $status==2}
 {if $fromuser}
 <input type="button" class="btn" value="Forwarding" onclick="Dd('_send').submit();"/>
 {/if}
 <input type="button" class="btn" value="Completely remove" onclick="if(confirm('You sure you want to delete this email? This action can not be revoked')) Go('?action=delete&itemid={$itemid}&forward={urlencode('?action=outbox')}');"/> 
{php $action='outbox'}
{elseif $status==1}
 {if $fromuser}
 <input type="button" class="btn" value="转 发" onclick="Dd('_send').submit();"/>
 {/if} 
 <input type="button" class="btn" value="Completely remove" onclick="if(confirm('You sure you want to delete this email? This action can not be revoked')) Go('?action=delete&itemid={$itemid}&forward={urlencode('?action=draft')}');"/>
{php $action='draft'}
{elseif $status==0}
	{php $action='inbox'}
{/if}
<form action="message.php" method="post" id="_send">
<input type="hidden" name="action" value="send"/>
<textarea name="title" class="dsn">{$title}</textarea>
<textarea name="content" class="dsn">{$content}</textarea>
</form>
</div>
{if $messages}
<div class="b10"></div>
<div class="ls">
<table cellspacing="0" cellpadding="0" class="tb">
<tr>
<th width="50">Type</th>
<th>&nbsp;Heading</th>
<th width="150">Sender</th>
<th width="170" align="center">Time</th>
</tr>
{loop $messages $message}
<tr align="center" onmouseover="this.className='on';" onmouseout="this.className='';">
<td><a href="?action={$action}&typeid={$message[typeid]}"><img src="{DT_STATIC}{$MODULE[2][moduledir]}/image/message_{$message[typeid]}.gif" width="16" height="16" title="{$NAME[$message[typeid]]}" alt=""/></a></td>
<td align="left"><a href="{if $status==1}?action=edit&itemid={$message[itemid]}{else}?action=show&itemid={$message[itemid]}{/if}"{if $status>2 && $message[feedback]}onclick="if(confirm('The letter requests a read receipt, whether to send?')){ Go(this.href+'&feedback=1');return false;}"{/if} class="f_b" title="{$message[title]}">{$message[dtitle]}</a></td>
<td align="center">{if $message[userurl]}<a href="{$message[userurl]}" target="_blank">{$message[user]}</a>{else}{$message[user]}{/if}</td>
<td>{$message[adddate]}</td>
</tr>
{/loop}
</table>
</div>
{/if}
{elseif $action == 'setting'}
<form method="post" action="message.php">
<input type="hidden" name="action" value="{$action}"/>
<table cellspacing="1" cellpadding="6" class="tb">
<tr>
<td class="tl" width="80">Blacklist</td>
<td class="tr f_gray"><textarea name="black" id="black" style="width:90%;height:100px;overflow:visible;">{$user[black]}</textarea><br/>[Prompt] Member name can be entered directly Member blacklisted, multiple member names are separated with a space key, please fill prohibit visitorsGuest</td>
</tr>
<tr style="display:{if !$could_send}none{/if};">
<td class="tl">Unread letter forwarding</td>
<td class="tr f_gray">
<input type="radio" name="send" value="1" {if $user[send]}checked{/if}/> Open&nbsp;&nbsp;&nbsp;&nbsp;
<input type="radio" name="send" value="0" {if !$user[send]}checked{/if}/> Close
&nbsp;&nbsp;
The system will automatically forwarded unread Station Letters to the registered email
</td>
</tr>
<tr>
<td class="tl"> </td>
<td height="50" class="tr">
<input type="submit" name="submit" value=" More new " class="btn"/>&nbsp;&nbsp;&nbsp;&nbsp;<input type="button" value=" Emptied " class="btn" onclick="Dd('black').value='';"/>&nbsp;&nbsp;&nbsp;&nbsp;<input type="reset" name="reset" value=" Reset " class="btn"/>
</td>
</tr>
</table>
</form>
{else}
<div class="tt">
<div class="mr">
<a href="?action={$action}" class="{if $typeid==-1}f_b{/if}">Entire</a>
{loop $NAME $k $v}
 | <a href="?action={$action}&typeid={$k}" class="{if $typeid==$k}f_b{/if}">{$v}</a>
{/loop}
</div>
<form action="message.php">
<input type="hidden" name="action" value="{$action}"/>
<input type="hidden" name="status" value="{$status}"/>
<select name="typeid">
<option value="-1">Type</option>
{loop $NAME $k $v}
<option value="{$k}"{if $k==$typeid} selected{/if}>{$v}</option>
{/loop}
</select>
<select name="style">
<option value="">Mark</option>
{loop $COLORS $v}
<option value="{$v}"{if $v==$style} selected{/if} style="background:#{$v};">&nbsp;</option>
{/loop}
</select>
<select name="fields">
<option value="title"{if $fields=='title'} selected{/if}>Title</option>
<option value="content"{if $fields=='content'} selected{/if}>Full text</option>
</select>
<input type="text" name="kw" value="{$kw}" size="30" title="Keyword"/>&nbsp;
<input type="submit" value=" Search " class="btn"/>
<input type="button" value=" Reset " class="btn" onclick="Go('?action={$action}');"/>
</form>
</div>
<form method="post">
<div class="ls">
<table cellspacing="0" cellpadding="0" class="tb">
<tr>
<th width="20"><input type="checkbox" onclick="checkall(this.form);"/></th>
<th width="28">Type</th>
<th>&nbsp;Heading</th>
{if $status>1}<th width="150">{if $status==2}Sender{else}Sender{/if}</th>{/if}
<th width="160" align="center">Time</th>
{if $status==3}
<th width="50" align="center">Mark</th>
{/if}
</tr>
{if $status==3}
{loop $systems $message}
<tr align="center" onmouseover="this.className='on';" onmouseout="this.className='';">
<td><input type="checkbox" disabled/></td>
<td><img src="{DT_STATIC}{$MODULE[2][moduledir]}/image/message_sys.gif" width="16" height="16" title="System broadcasts" alt=""/></td>
<td align="left"><a href="?action=show&itemid={$message[itemid]}"><span class="f_red" title="{$message[title]}">{$message[title]}</span></a></td>
<td>{$message[user]}</td>
<td>{$message[adddate]}</td>
{if $status==3}<td>--</td>{/if}
</tr>
{/loop}
{/if}
{loop $messages $message}
<tr align="center" onmouseover="this.className='on';" onmouseout="this.className='';">
<td><input type="checkbox" name="itemid[]" value="{$message[itemid]}"/></td>
<td><a href="?action={$action}&typeid={$message[typeid]}"><img src="{DT_STATIC}{$MODULE[2][moduledir]}/image/message_{$message[typeid]}.gif" width="16" height="16" title="{$NAME[$message[typeid]]}" alt=""/></a></td>
<td align="left"><a href="{if $status==1}?action=edit&itemid={$message[itemid]}{else}?action=show&itemid={$message[itemid]}{/if}"{if $status>2 && !$message[isread]} class="f_b"{if $message[feedback]}onclick="if(confirm('The letter requests a read receipt, whether to send?')){ Go(this.href+'&feedback=1');return false;}"{/if}{/if}{if $message[style]} style="color:#{$message[style]};"{/if} class="t" title="{$message[title]}&#10;Number：{$message[itemid]}">{$message[dtitle]}</a></td>
{if $status>1}<td align="center">{if $message[userurl]}<a href="{$message[userurl]}" target="_blank">{$message[user]}</a>{else}{$message[user]}{/if}</td>{/if}
<td>{$message[adddate]}</td>
{if $status==3}
<td>
<select name="style" onchange="Go('?itemid={$message[itemid]}&action=color&style='+this.value);">
<option value="">Mark</option>
<option value="">Cancel</option>
{$color_select}
</select>
</td>
{/if}
</tr>
{/loop}
</table>
<div class="btns">
{if $status==4}
<input type="submit" value=" Restore " class="btn" onclick="this.form.action='?action=restore';"/>
<input type="submit" value=" Completely remove " class="btn" onclick="if(confirm('You sure you want to delete the selected email? This action can not be revoked')){this.form.action='?action=delete';}else{return false;}"/>
{elseif $status==3}
<span class="f_r">
<input type="text" value="Enter the number,如135" size="15" id="m_id" onfocus="if(this.value=='Enter the number,如135')this.value='';"/>
<input type="button" value=" View " class="btn" onclick="if(Dd('m_id').value.match(/^[0-9]{1,}$/)){Go('?action=show&itemid='+Dd('m_id').value);return;}Dd('m_id').value='';Dd('m_id').focus();"/>
</span>
<input type="submit" value=" Mark Read " class="btn" onclick="this.form.action='?action=mark';"/>
<input type="submit" value=" Recycle " class="btn" onclick="this.form.action='?action=delete';"/>
<input type="submit" value=" Completely remove " class="btn" onclick="if(confirm('You sure you want to delete the selected email? This action can not be revoked')){this.form.action='?action=delete&recycle=0';}else{return false;}"/>
{else}
<input type="submit" value=" Completely remove " class="btn" onclick="if(confirm('You sure you want to delete the selected email? This action can not be revoked')){this.form.action='?action=delete';}else{return false;}"/>
{/if}
<input type="submit" value=" Emptied " class="btn" onclick="if(confirm('Sure you want to empty the{$name}Correspondence? This action can not be revoked')){this.form.action='?action=clear&status={$status}';}else{return false;}"/>
</div>
</form>
</div>
{if $status==3}
{if $MG[inbox_limit]}
<div class="limit">Inbox Capacity <span class="f_b f_red">{$MG[inbox_limit]}</span> Article&nbsp;&nbsp;&nbsp;Current reception <span class="f_b">{$limit_used}</span> Article&nbsp;&nbsp;&nbsp;Can also receive <span class="f_b f_blue">{$limit_free}</span> 条&nbsp;&nbsp;&nbsp;Recommends that you delete unwanted mail</div>
{/if}
{/if}
<div class="pages">{$pages}</div>
{/if}
<script type="text/javascript">s('message');m('{$action}');</script>
{template 'footer',$module}